package com.gzsolar.common.controller;

import Interceptor.LoginInterceptor;

import com.gzsolar.common.model.BiUser;
import com.jfinal.aop.Before;
import com.jfinal.aop.Clear;
import com.jfinal.core.Controller;

public class LoginController extends Controller {
	
	@Clear
	public void index(){
		BiUser biUser = getModel(BiUser.class,"bi_user");
		biUser = biUser.findFirst("SELECT * FROM BI_User WHERE NAME = ? AND PASSWORD = ?", biUser.getName(),biUser.getPassword());
		if(biUser != null ){
			setSessionAttr("bi_user",  biUser.getName());
			render("/template/welcome.html");
		}else{
			renderError(404, "/template/index/index.html");
		}
		
	}
	
	public void resert(){
		render("/template/welcome.html");
	}
}
